package com.monitoring.management.common.page;

import java.util.List;

/**
 * Created by liujunnan on 2017/6/8.
 */
public class Page<T> {
    public int getPageCode() {
        return pageCode;
    }

    public void setPageCode(int pageCode) {
        this.pageCode = pageCode;
    }

    public int getTotalPage() {
        int totalPage = this.totalRecord / pageSize;
        return totalRecord % pageSize == 0 ? totalPage : totalPage + 1;
    }


    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalRecord() {
        return totalRecord;
    }

    public void setTotalRecord(int totalRecord) {
        this.totalRecord = totalRecord;
    }

    public List<T> getDatas() {
        return datas;
    }

    public void setDatas(List<T> datas) {
        this.datas = datas;
    }

    private int pageCode;
    private int totalPage;
    private int pageSize = 10;
    private int totalRecord;
    private List<T> datas;

    public Page() {
    }
    public Page(int pageCode, int totalRecord) {
      this(pageCode,totalRecord,10);
    }
    public Page(int pageCode, int totalRecord, int pageSize) {
        this.pageCode = pageCode;
        this.totalRecord = totalRecord;
        this.pageSize = pageSize;
    }

}
